package com.ibm.productivity.tools.blogplugin.views;

import java.util.ArrayList;

public class ArticleParent extends ArticleNode {
	private ArrayList<ArticleNode> children;

	public ArticleParent(){
		this("No name");
	}
	
	public ArticleParent(String name) {
		super(name, -1);
		children = new ArrayList<ArticleNode>();
	}
	
	public ArticleParent(String name, int id) {
		super(name, id);
		children = new ArrayList<ArticleNode>();
	}

	public void addChild(ArticleNode child) {
		children.add(child);
		child.setParent(this);
	}

	public void removeChild(ArticleNode child) {
		children.remove(child);
		child.setParent(null);
	}

	public ArticleNode[] getChildren() {
		return children.toArray(new ArticleNode[children.size()]);
	}

	public boolean hasChildren() {
		return children.size() > 0;
	}
	
	public int getChildCount() {
		return children.size();
	}
}
